package controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import pojo.Title;
import service.TitleService;

import java.util.List;

@Controller
@RequestMapping("/title")
public class TitleController {
    @Autowired
    private TitleService titleService;

    public TitleService getTitleService() {
        return titleService;
    }

    public void setTitleService(TitleService titleService) {
        this.titleService = titleService;
    }
    @RequestMapping("getTitles.do")
    public String getTitles(){
        List<Title> titles = titleService.getTitles();
        if(titles!=null){
            System.out.println(1);
        }else{
            System.out.println(2);
        }
        for (Title title : titles) {
            System.out.println(title);
        }
        return "";
    }
}
